package com.atguigu.chaptar1

import scala.util.control.Breaks.{break, breakable}

object MyFunctionDemo {
  def main(args: Array[String]): Unit = {
    try {
      for (i <- 1 to 10) {
        print(i)
        if (i == 5) throw new Exception
      }
    } catch {
      case e:Exception =>
    }
    print("break跳出")
    print("--------------------")
    for (i<-1 to 10){
      try {
        if (i == 5) throw new Exception
        print(i)
      } catch {
        case e:Exception =>
      }
    }
    print("哈哈continue跳过5进入下一次了")
    println("---------------")
    breakable({
      for(i<-1 to 10){
        print(i)
        if(i==5)break()
      }
    })
    print("haha实现了break功能")
    for(i<-1 to 10){
      breakable({if(i==5)break()
        print(i)})
    }
    print("haha实现了continue功能")
    def sum(x:Int*)=x
    def sum1(x:Int*)=x.sum

  }


}
